package com.jh.browser.adapter;

import android.text.TextUtils;

import com.jh.browser.bean.NetWorkBean;
import com.jh.browser.common.Common;
import com.jh.browser.holder.MyBaseViewHolder;
import com.jh.browser.holder.NetWorkHolder;

import java.util.ArrayList;

public class NetWorkAdapter extends MyBaseAdapter<NetWorkBean> {
    public NetWorkAdapter(ArrayList<NetWorkBean> data) {
        super(data);
    }

    @Override
    public void initView(NetWorkBean item, MyBaseViewHolder viewHolder) {
        NetWorkHolder netWorkHolder = (NetWorkHolder) viewHolder;
        String extension = Common.getExtension(item.url);
        if (!TextUtils.isEmpty(extension)) {
            netWorkHolder.tv_url.setText("[ " + extension + " ] " + item.url);
        } else {
            netWorkHolder.tv_url.setText(item.url);
        }
    }

    @Override
    public NetWorkHolder getHolder() {
        return new NetWorkHolder();
    }
}
